/*
 * Copyright 2011-2020 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0.
 * See `LICENSE` in the project root for license information.
 */

package me.ijleex.mgmt.system.uploadfile.autoconfigure;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * 上传文件配置
 *
 * @author liym
 * @since 2019-10-30 21:09 新建
 */
@ConfigurationProperties(prefix = "top.upload-file")
@Configuration
public class UploadFileProperties {

    private final LocalFs localFs = new LocalFs();

    public LocalFs getLocalFs() {
        return this.localFs;
    }

    /**
     * 上传文件到本地文件系统配置
     */
    public static class LocalFs {

        /**
         * 本地上传文件目录的根目录，如 D:/x-files 或 /opt/openapi/x-files
         *
         * <p>{@code upload-file.local-fs.path}</p>
         */
        private String path;
        /**
         * 请求本地文件的 URL 前缀，如 /local-fs/**
         *
         * <p>{@code upload-file.local-fs.path-pattern}</p>
         */
        private String pathPattern;

        public String getPath() {
            return this.path;
        }

        public void setPath(String path) {
            this.path = path;
        }

        public String getPathPattern() {
            return this.pathPattern;
        }

        public void setPathPattern(String pathPattern) {
            this.pathPattern = pathPattern;
        }

    }

    /**
     * 上传文件到 Ali-OSS 配置
     */
    public static class AliOss {

        private String endpoint;
        private String accessKeyId;
        private String accessKeySecret;
        private String bucket;
        private String folder;

        public String getEndpoint() {
            return this.endpoint;
        }

        public void setEndpoint(String endpoint) {
            this.endpoint = endpoint;
        }

        public String getAccessKeyId() {
            return this.accessKeyId;
        }

        public void setAccessKeyId(String accessKeyId) {
            this.accessKeyId = accessKeyId;
        }

        public String getAccessKeySecret() {
            return this.accessKeySecret;
        }

        public void setAccessKeySecret(String accessKeySecret) {
            this.accessKeySecret = accessKeySecret;
        }

        public String getBucket() {
            return this.bucket;
        }

        public void setBucket(String bucket) {
            this.bucket = bucket;
        }

        public String getFolder() {
            return this.folder;
        }

        public void setFolder(String folder) {
            this.folder = folder;
        }

    }

}
